home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / doodle_d.swf / scripts / DefineSprite_35_en8 / frame_1 / DoAction.as
Text File  |  2013-04-24  |  1KB  |  47 lines

  1. function onEnterFrame()
  2. {
  3.    if(_root.shieldMC.hitTest(_X,_Y,true) && _root.shieldLevel >= 2)
  4.    {
  5.       dx = 0;
  6.       dy = 0;
  7.    }
  8.    fx = _X - _root.ship._x + 1e-13;
  9.    fy = _Y - _root.ship._y;
  10.    radians = Math.atan(fy / fx);
  11.    if(_root.ship._x < _X)
  12.    {
  13.       radians -= 3.141592653589793;
  14.    }
  15.    thrustDX = speed * Math.cos(radians);
  16.    thrustDY = speed * Math.sin(radians);
  17.    dx = thrustDX;
  18.    dy = thrustDY;
  19.    _X = _X + dx;
  20.    _Y = _Y + dy;
  21.    if(this.hitTest(_root.ship))
  22.    {
  23.       depth = _root.getNextHighestDepth();
  24.       _root.attachMovie("exp","exp" + depth,depth);
  25.       exp = eval("_root.exp" + depth);
  26.       exp._x = _X;
  27.       exp._y = _Y;
  28.       _root.death();
  29.       _root.eAmount--;
  30.       this.removeMovieClip();
  31.    }
  32.    if(h <= 0)
  33.    {
  34.       _root.eAmount--;
  35.       _root.points += 150;
  36.       _root.eD = _root.eD + 1;
  37.       depth = _root.getNextHighestDepth();
  38.       _root.attachMovie("exp","exp" + depth,depth);
  39.       exp = eval("_root.exp" + depth);
  40.       exp._x = _X;
  41.       exp._y = _Y;
  42.       this.removeMovieClip();
  43.    }
  44. }
  45. speed = 5;
  46. h = 5;
  47.